﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>注册</title>
    <script src="jquery-1.12.4.js"></script>
    <script type="text/javascript">
        $(function () {
            var user = {"id":1,"name":"张三","pwd":"000"};

            $("#objectDiv").append("ID：" +  + "<br>")
            .append("用户名：" + user.name + "<br>")
            .append("密码：" + user.pwd + "<br>")
             var ary = [ "中", "美", "俄" ];
             var $ary = $(ary);
             var $ul = $("#arrayUl");
             var $sel = $("#arraySel");
             $ary.each(function() { $ul.append("<li>"+this+"</li>"); });
             $ary.each(function(i) {
                $sel.append("<option value='"+(i+1)+"'>"+this+"</option>");
             });
             var userArray = [ {
                 "id" : 2,
                 "name" : "admin",
                 "pwd" : "123"
             }, {
                 "id" : 3,
                 "name" : "詹姆斯",
                 "pwd" : "11111"
             }, {
                 "id" : 4,
                 "name" : "梅西",
                 "pwd" : "6666"
             } ];
             var $table = $("<table border='1'></table>").append(
                    "<tr><td>ID</td><td>用户名</td><td>密码</td></tr>");
             $(userArray).each(function() {
                $table.append("<tr><td>" + this.id + "</td><td>"
                             + this.name + "</td><td>"
                             + this.pwd + "</td></tr>");
             });
             $("#objectArrayDiv").append($table);
        })
    </script>


</head>
    <body>+
    一、JSON格式的user对象:<div id="objectDiv"></div><br>
    二、JSON格式的字符串数组:&nbsp;&nbsp;<select id="arraySel"></select>
    <ul id="arrayUl"></ul>
    三、JSON格式的user对象数组:<div id="objectArrayDiv"></div>
    </body>
</html>